--[1How many sounds used,2number of sounds on disk,3EdgeInc--Running count of the number of times this class of sound file is called, 4EdgeWhen--how often Edge appears,5EDGELImit--number of edge files on disk,6EdgeUsed--Random list of EdgeFiles that are unused] on IncSnd thesnd global SndList,SndLimitList,BobbyMuzzle --global SndVals,SoundUsed,SoundLimit,EdgeInc,EdgeWhen,EdgeLimit,EdgeUsed if BobbyMuzzle = true then return makeAPath (theSnd & "@" & TheSnd & 1) exit end if put GetAProp(SndList,TheSnd) into SndVals put GetAt(SndVals,1) into SoundUsed put GetAt(SndVals,2) into SoundLimit put GetAt(SndVals,3) into EdgeInc put GetAt(SndVals,4) into EdgeWhen put GetAt(SndVals,5) into EdgeLimit put GetAt(SndVals,6) into EdgeUsed --put "EdgeUsed" && EdgeUsed -- put "EdgeLimit" && EdgeLimit --first check to see if it is time to use an "Edge" sound --we increment EdgeUsed first, every time the sound file is called. set EdgeInc = EdgeInc + 1 --put "EdgeStuff" && EdgeInc && EdgeWhen if Edgewhen > 0 AND EdgeInc mod EdgeWhen = 0 then --if EdgeWhen is 0, then there are no edge files. Skip to normal sounds. -- for example, if its every 7th time, then if EdgeInc = 14 and EdgeWhen = 7 then --its time for an edge file, so we get the next edge file and use it set EdgeNum = GetAt(EdgeUsed,1) DeleteAt EdgeUsed,1 if count(EdgeUsed) = 0 then Set EdgeUsed = MakeRandList(EdgeLimit) --makes a new random list from which to pull Edge files. end if --now reLoad the mySnd list with the values that have changed --put "SndVals" && SndVals SetAt(SndVals,3,EdgeInc) SetAt(SndVals,6,EdgeUsed) SetaProp(Sndlist,value(TheSnd),SndVals) --put makeAPath (thesnd & "@Edge@" & thesnd & EdgeNum) return makeAPath (thesnd & "@Edge@" & thesnd & EdgeNum) else --its not time for an "EDGE" file, so increment the normal sound file and use it. -- put "SoundUsed" && soundUsed --put count(soundUsed) put GetAt(soundUsed,1) into SU DeleteAt value(SoundUsed),1 if count(SoundUsed) = 0 then set SoundUsed = MakeRandList(SoundLimit) end if --now reLoad the SndVals list with the value that has changed SetAt(SndVals,1,SoundUsed) SetAt(SndVals,3,EdgeInc) SetaProp(Sndlist,value(TheSnd),SndVals) --put makeAPath (theSnd & "@"& TheSnd & SU) return makeAPath (theSnd & "@" & TheSnd & SU) end if end IncSnd